<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">



    <link rel="shortcut icon" href="favicon.ico"> <link href="__PUBLIC__/dist/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/plugins/switchery/switchery.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/style.min862f.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <div class="col-sm-12">
            <div class="tabs-container">
                <ul class="nav nav-tabs">
                    <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">通用信息</a></li>
                    <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">详情描述</a></li>
                    <li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">服务相册</a></li>
                    <li class=""><a data-toggle="tab" href="#tab-4" aria-expanded="false">服务属性</a></li>
                </ul>
                <form method="post" class="form-horizontal">
                    {if condition="$businesses_id eq 0"}
                    <div class="form-group draggable ui-draggable">
                        <label class="col-sm-2 control-label">所属商家：</label>
                        <div class="col-sm-6">
                            <select id="businesses_id" name="businesses_id" class="form-control" required>
                                {foreach name="businesses" item="item"}
                                {if condition="$item['id'] eq $info['businesses_id']"}
                                <option value="{$item.id}" selected="selected">
                                    {$item.name}
                                </option>
                                {else/}
                                <option value="{$item.id}">
                                    {$item.name}
                                </option>
                                {/if}
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    {else/}
                    <input type="hidden" name="businesses_id" value="{$businesses_id}">
                    {/if}
                    <div class="tab-content">
                        <!--通用信息-->
                        <div id="tab-1" class="tab-pane active">
                            <div class="panel-body">
                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">服务名称</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" name="goods_name" value="{$info.goods_name}" required>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">分类</label>
                                    <div class="col-sm-10">
                                        <select name="cate_id" class="form-control" required>
                                            <option value="">请选择分类</option>
                                            {foreach name="cateList" item="item"}
                                                <option value="{$item.id}" {if condition="$item['id'] eq $info['cate_id']"}selected{/if} >{$item.name}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">普通价格</label>
                                    <div class="col-sm-10">
                                        <input type="text" name="price" class="form-control" value="{$info.price}" required>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">VIP价格</label>
                                    <div class="col-sm-10">
                                        <input type="text" name="vip_price" class="form-control" value="{$info.vip_price}" required>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">上架</label>
                                    <div class="col-sm-2">
                                        <input type="checkbox" class="js-switch" name="is_on_sale" value="1" {if condition="$info['is_on_sale'] eq 1"}checked{/if} />
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">封面图</label>
                                    <div class="col-sm-3" id="file-pretty">
                                        <div class="input-append input-group">
                                            <span class="input-group-btn">
                                                <button class="btn btn-white" type="button" onclick="GetUploadify(1,'','goods','call_back');">选择文件</button>
                                            </span>
                                            <input class="input-large form-control" id="original_img_input" type="text" name="image" value="{$info.image}">
                                        </div>
                                    </div>
                                    <div class="col-sm-1" id="original_img" style="position: relative;">
                                        {if condition="$info['image']"}
                                            <img src="{$info.image}" alt="" class="goods-image" style="height:34px">
                                            <div style="position:absolute;bottom:0;left:65px;display:none;border: 1px solid #ccc;"><img src="{$info.image}" alt="" style="max-width: 500px;z-index: 999"></div>
                                        {/if}
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">销量</label>
                                    <div class="col-sm-10">
                                        <input type="text" name="sales_sum" class="form-control" value="{$info.sales_sum}" required>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <button class="btn btn-primary" type="submit">保存内容</button>
                                        <button class="btn btn-white" type="button" onclick="history.back()">取消</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--详情描述-->
                        <div id="tab-2" class="tab-pane">
                            <div class="panel-body">
                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">服务描述</label>
                                    <div class="col-sm-10">
                                        <textarea name="description" id="editor2">{$info.description}</textarea>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group">
                                    <label class="col-sm-2 control-label">服务详情</label>
                                    <div class="col-sm-10">
                                        <textarea name="content" id="editor">{$info.content}</textarea>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <button class="btn btn-primary" type="submit">保存内容</button>
                                        <button class="btn btn-white" type="button" onclick="history.back()">取消</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--服务相册-->
                        <div id="tab-3" class="tab-pane">
                            <div class="panel-body">
                                <div class="hr-line-dashed"></div>
                                <div class="row" id="photoBox">
                                    <div class="col-md-2 " style="text-align: center">
                                        <a href="javascript:;" class="fa fa-plus-square-o" onclick="GetUploadify(10,'','goods','call_back2');" style="width: 100%;font-size: 155px;"></a>
                                    </div>

                                    <div class="col-md-2 photoModel" style="display:none">
                                        <div class="ibox-content text-center" style="border: 0;">
                                            <div class="m-b-sm">
                                                <img alt="image" src="__PUBLIC__/dist/img/a8.jpg" style="max-width: 100%;max-height: 110px;">
                                            </div>

                                            <div class="text-center">
                                                <a href="javascript:;" class="btn btn-xs btn-white delImage" data-path=""><i class="fa fa-trash-o"></i> 删除 </a>
                                            </div>
                                        </div>
                                    </div>

                                    {foreach name="goodsImages" item="item"}
                                        <div class="col-md-2">
                                            <div class="ibox-content text-center" style="border: 0;">
                                                <div class="m-b-sm">
                                                    <img alt="image" src="{$item.image}" style="max-width: 100%;max-height: 110px;">
                                                </div>

                                                <div class="text-center">
                                                    <a href="javascript:;" class="btn btn-xs btn-white delImage" data-path="{$item.image}"><i class="fa fa-trash-o"></i> 删除 </a>
                                                </div>
                                            </div>
                                            <input type="hidden" name="goods_images[]" value="{$item.image}">
                                        </div>
                                    {/foreach}


                                </div>
                                <div class="hr-line-dashed"></div>

                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <button class="btn btn-primary" type="submit">保存内容</button>
                                        <button class="btn btn-white" type="button" onclick="history.back()">取消</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--服务属性-->
                        <div id="tab-4" class="tab-pane">
                            <div class="panel-body">

                                <div class="hr-line-dashed"></div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">服务类型</label>
                                    <div class="col-sm-6">
                                        <select name="type_id" id="goods_type" class="form-control">
                                            <option value="">请选择服务类型</option>
                                            {foreach name="typeList" item="item"}
                                                <option value="{$item.id}" {if condition="$item['id'] eq $info['type_id']"}selected{/if} >{$item.name}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>

                                <div class="hr-line-dashed"></div>
                                <div id="ajax_attr_box" style="display: none">

                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" type="submit">保存内容</button>
                                    <button class="btn btn-white" type="button" onclick="history.back()">取消</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>


            </div>
        </div>


    </div>
</div>


<script src="__PUBLIC__/dist/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/dist/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/dist/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/dist/js/plugins/iCheck/icheck.min.js"></script>
<script src="__PUBLIC__/dist/js/plugins/switchery/switchery.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/libs/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/libs/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/libs/global.js?rnd=12345678"> </script>
<script>
    UE.getEditor('editor');
    UE.getEditor('editor2');
    new Switchery(document.querySelector('.js-switch'));
    new Switchery(document.querySelector('.js-switch-2'));
    new Switchery(document.querySelector('.js-switch-3'));
    new Switchery(document.querySelector('.js-switch-4'));
    $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});


    /*
     * 以下是图片上传方法
     */
    // 上传服务图片成功回调函数
    function call_back(fileurl_tmp){
        $("#original_img").html('<img src="'+fileurl_tmp+'" alt="" style="height:34px">');
        $('#original_img_input').val(fileurl_tmp);
    }

    // 上传服务相册回调函数
    function call_back2(paths){
        for (var i=0;i<paths.length ;i++ ) {
            var clone = $('.photoModel').clone(true);
            clone.find('img').attr('src',paths[i]);
            clone.find('.delImage').attr('data-path',paths[i]);
            clone.append('<input type="hidden" name="goods_images[]" value="'+paths[i]+'">');
            clone.removeClass('photoModel');
            $('#photoBox').append(clone.show());
        }
    }

    //删除服务相册图片
    $('.delImage').click(function(){
        var obj = $(this);
        var path = obj.data('path');
        $.ajax({
            type:'GET',
            url:"{:Url('Uploadify/delupload')}",
            data:{action:"del", filename:path},
            success:function(){
                $(obj).parents('.col-md-2').remove(); // 删除完服务器的, 再删除 html上的图片
            }
        });
        // 删除数据库记录
        $.ajax({
            type:'GET',
            url:"{:Url('Goods/del_goods_images')}",
            data:{filename:path},
            success:function(){
                //
            }
        });
    });
    //获取服务类型属性
    $('#goods_type').change(function(){
        var type_id = $(this).val();
        getAttrBox(type_id);
    });
    if("{$info['type_id']}" != '' && "{$info['type_id']}" != 0){
        getAttrBox("{$info['type_id']}");
    }

    function getAttrBox(type_id){
        if(!type_id){
            return;
        }
        $.ajax({
            type:'GET',
            url:"{:Url('Goods/getGoodsTypeAttribute')}",
            data:{type_id:type_id,goods_id:"{$info['id']}"},
            dataType:'html',
            success:function(res){
                $('#ajax_attr_box').html(res);
                $('#ajax_attr_box').show();
            }
        })
    }

    $('.goods-image').mouseover(function(){
        $(this).next().show();
    }).mouseout(function(){
        $(this).next().hide();
    });

    $(document)
        .off('click','.attrList .fa-plus')
        .on('click','.attrList .fa-plus',function(){
            var model = $(this).parent().parent();
            var clone = model.clone();
            clone.find('.attr_price').val('');
            clone.find('select').val('');
            clone.find('.fa-plus').attr('class','fa fa-minus');
            model.parent().append(clone);
        });
    $(document)
        .off('click','.attrList .fa-minus')
        .on('click','.attrList .fa-minus',function(){
            $(this).parent().parent().remove();
        });
</script>

</body>


<!-- Mirrored from www.zi-han.net/theme/hplus/form_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:19:15 GMT -->
</html>
